\doxysection{remote\+\_\+control.\+h}
\hypertarget{remote__control_8h_source}{}\label{remote__control_8h_source}\index{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/remote/remote\_control.h@{C:/Users/ASUS/Desktop/dm-\/ctrlH7-\/balance-\/9025test/modules/remote/remote\_control.h}}
\mbox{\hyperlink{remote__control_8h}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ }
\DoxyCodeLine{00013\ \textcolor{preprocessor}{\#ifndef\ REMOTE\_CONTROL\_H}}
\DoxyCodeLine{00014\ \textcolor{preprocessor}{\#define\ REMOTE\_CONTROL\_H}}
\DoxyCodeLine{00015\ }
\DoxyCodeLine{00016\ \textcolor{preprocessor}{\#include\ <stdint.h>}}
\DoxyCodeLine{00017\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{main_8h}{main.h}}"{}}}
\DoxyCodeLine{00018\ \textcolor{preprocessor}{\#include\ "{}\mbox{\hyperlink{usart_8h}{usart.h}}"{}}}
\DoxyCodeLine{00019\ }
\DoxyCodeLine{00020\ \textcolor{comment}{//\ 用于遥控器数据读取,遥控器数据是一个大小为2的数组}}
\DoxyCodeLine{00021\ \textcolor{preprocessor}{\#define\ LAST\ 1}}
\DoxyCodeLine{00022\ \textcolor{preprocessor}{\#define\ TEMP\ 0}}
\DoxyCodeLine{00023\ }
\DoxyCodeLine{00024\ \textcolor{comment}{//\ 获取按键操作}}
\DoxyCodeLine{00025\ \textcolor{preprocessor}{\#define\ KEY\_PRESS\ 0}}
\DoxyCodeLine{00026\ \textcolor{preprocessor}{\#define\ KEY\_STATE\ 1}}
\DoxyCodeLine{00027\ \textcolor{preprocessor}{\#define\ KEY\_PRESS\_WITH\_CTRL\ 1}}
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#define\ KEY\_PRESS\_WITH\_SHIFT\ 2}}
\DoxyCodeLine{00029\ }
\DoxyCodeLine{00030\ \textcolor{comment}{//\ 检查接收值是否出错}}
\DoxyCodeLine{00031\ \textcolor{preprocessor}{\#define\ RC\_CH\_VALUE\_MIN\ ((uint16\_t)364)}}
\DoxyCodeLine{00032\ \textcolor{preprocessor}{\#define\ RC\_CH\_VALUE\_OFFSET\ ((uint16\_t)1024)}}
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\#define\ RC\_CH\_VALUE\_MAX\ ((uint16\_t)1684)}}
\DoxyCodeLine{00034\ }
\DoxyCodeLine{00035\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ RC\ Switch\ Definition-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00036\ \textcolor{preprocessor}{\#define\ RC\_SW\_UP\ ((uint16\_t)1)\ \ \ }\textcolor{comment}{//\ 开关向上时的值}}
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#define\ RC\_SW\_MID\ ((uint16\_t)3)\ \ }\textcolor{comment}{//\ 开关中间时的值}}
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#define\ RC\_SW\_DOWN\ ((uint16\_t)2)\ }\textcolor{comment}{//\ 开关向下时的值}}
\DoxyCodeLine{00039\ \textcolor{comment}{//\ 三个判断开关状态的宏}}
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#define\ switch\_is\_down(s)\ (s\ ==\ RC\_SW\_DOWN)}}
\DoxyCodeLine{00041\ \textcolor{preprocessor}{\#define\ switch\_is\_mid(s)\ (s\ ==\ RC\_SW\_MID)}}
\DoxyCodeLine{00042\ \textcolor{preprocessor}{\#define\ switch\_is\_up(s)\ (s\ ==\ RC\_SW\_UP)}}
\DoxyCodeLine{00043\ }
\DoxyCodeLine{00044\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ PC\ Key\ Definition-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00045\ \textcolor{comment}{//\ 对应key[x][0\string~16],获取对应的键;例如通过key[KEY\_PRESS][Key\_W]获取W键是否按下,后续改为位域后删除}}
\DoxyCodeLine{00046\ \textcolor{preprocessor}{\#define\ Key\_W\ 0}}
\DoxyCodeLine{00047\ \textcolor{preprocessor}{\#define\ Key\_S\ 1}}
\DoxyCodeLine{00048\ \textcolor{preprocessor}{\#define\ Key\_D\ 2}}
\DoxyCodeLine{00049\ \textcolor{preprocessor}{\#define\ Key\_A\ 3}}
\DoxyCodeLine{00050\ \textcolor{preprocessor}{\#define\ Key\_Shift\ 4}}
\DoxyCodeLine{00051\ \textcolor{preprocessor}{\#define\ Key\_Ctrl\ 5}}
\DoxyCodeLine{00052\ \textcolor{preprocessor}{\#define\ Key\_Q\ 6}}
\DoxyCodeLine{00053\ \textcolor{preprocessor}{\#define\ Key\_E\ 7}}
\DoxyCodeLine{00054\ \textcolor{preprocessor}{\#define\ Key\_R\ 8}}
\DoxyCodeLine{00055\ \textcolor{preprocessor}{\#define\ Key\_F\ 9}}
\DoxyCodeLine{00056\ \textcolor{preprocessor}{\#define\ Key\_G\ 10}}
\DoxyCodeLine{00057\ \textcolor{preprocessor}{\#define\ Key\_Z\ 11}}
\DoxyCodeLine{00058\ \textcolor{preprocessor}{\#define\ Key\_X\ 12}}
\DoxyCodeLine{00059\ \textcolor{preprocessor}{\#define\ Key\_C\ 13}}
\DoxyCodeLine{00060\ \textcolor{preprocessor}{\#define\ Key\_V\ 14}}
\DoxyCodeLine{00061\ \textcolor{preprocessor}{\#define\ Key\_B\ 15}}
\DoxyCodeLine{00062\ }
\DoxyCodeLine{00063\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ Data\ Struct\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00064\ \textcolor{comment}{//\ 待测试的位域结构体,可以极大提升解析速度}}
\DoxyCodeLine{00065\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{union}}
\DoxyCodeLine{00066\ \{}
\DoxyCodeLine{00067\ \ \ \ \ \textcolor{keyword}{struct\ }\textcolor{comment}{//\ 用于访问键盘状态}}
\DoxyCodeLine{00068\ \ \ \ \ \{}
\DoxyCodeLine{00069\ \ \ \ \ \ \ \ \ uint16\_t\ w\ :\ 1;}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ uint16\_t\ s\ :\ 1;}
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ uint16\_t\ d\ :\ 1;}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ uint16\_t\ a\ :\ 1;}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ uint16\_t\ shift\ :\ 1;}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ uint16\_t\ ctrl\ :\ 1;}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ uint16\_t\ q\ :\ 1;}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ uint16\_t\ e\ :\ 1;}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ uint16\_t\ r\ :\ 1;}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ uint16\_t\ f\ :\ 1;}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ uint16\_t\ g\ :\ 1;}
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ uint16\_t\ z\ :\ 1;}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ uint16\_t\ x\ :\ 1;}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ uint16\_t\ c\ :\ 1;}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ uint16\_t\ v\ :\ 1;}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ uint16\_t\ b\ :\ 1;}
\DoxyCodeLine{00085\ \ \ \ \ \};}
\DoxyCodeLine{00086\ \ \ \ \ uint16\_t\ keys;\ \textcolor{comment}{//\ 用于memcpy而不需要进行强制类型转换}}
\DoxyCodeLine{00087\ \}\ \mbox{\hyperlink{union_key__t}{Key\_t}};}
\DoxyCodeLine{00088\ }
\DoxyCodeLine{00089\ \textcolor{comment}{//\ @todo\ 当前结构体嵌套过深,需要进行优化}}
\DoxyCodeLine{00090\ \textcolor{keyword}{typedef}\ \textcolor{keyword}{struct}}
\DoxyCodeLine{00091\ \{}
\DoxyCodeLine{00092\ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00093\ \ \ \ \ \{}
\DoxyCodeLine{00094\ \ \ \ \ \ \ \ \ int16\_t\ rocker\_l\_;\ \textcolor{comment}{//\ 左水平}}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ int16\_t\ rocker\_l1;\ \textcolor{comment}{//\ 左竖直}}
\DoxyCodeLine{00096\ \ \ \ \ \ \ \ \ int16\_t\ rocker\_r\_;\ \textcolor{comment}{//\ 右水平}}
\DoxyCodeLine{00097\ \ \ \ \ \ \ \ \ int16\_t\ rocker\_r1;\ \textcolor{comment}{//\ 右竖直}}
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ int16\_t\ dial;\ \ \ \ \ \ \textcolor{comment}{//\ 侧边拨轮}}
\DoxyCodeLine{00099\ }
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ uint8\_t\ switch\_left;\ \ \textcolor{comment}{//\ 左侧开关}}
\DoxyCodeLine{00101\ \ \ \ \ \ \ \ \ uint8\_t\ switch\_right;\ \textcolor{comment}{//\ 右侧开关}}
\DoxyCodeLine{00102\ \ \ \ \ \}\ rc;}
\DoxyCodeLine{00103\ \ \ \ \ \textcolor{keyword}{struct}}
\DoxyCodeLine{00104\ \ \ \ \ \{}
\DoxyCodeLine{00105\ \ \ \ \ \ \ \ \ int16\_t\ x;}
\DoxyCodeLine{00106\ \ \ \ \ \ \ \ \ int16\_t\ y;}
\DoxyCodeLine{00107\ \ \ \ \ \ \ \ \ uint8\_t\ press\_l;}
\DoxyCodeLine{00108\ \ \ \ \ \ \ \ \ uint8\_t\ press\_r;}
\DoxyCodeLine{00109\ \ \ \ \ \}\ mouse;}
\DoxyCodeLine{00110\ }
\DoxyCodeLine{00111\ \ \ \ \ \mbox{\hyperlink{union_key__t}{Key\_t}}\ key[3];\ \textcolor{comment}{//\ 改为位域后的键盘索引,空间减少8倍,速度增加16\string~倍}}
\DoxyCodeLine{00112\ }
\DoxyCodeLine{00113\ \ \ \ \ uint8\_t\ key\_count[3][16];}
\DoxyCodeLine{00114\ \}\ \mbox{\hyperlink{struct_r_c__ctrl__t}{RC\_ctrl\_t}};}
\DoxyCodeLine{00115\ }
\DoxyCodeLine{00116\ \textcolor{comment}{/*\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ Internal\ Data\ -\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/\ */}}
\DoxyCodeLine{00117\ }
\DoxyCodeLine{00124\ \mbox{\hyperlink{struct_r_c__ctrl__t}{RC\_ctrl\_t}}\ *\mbox{\hyperlink{remote__control_8h_a1ae5e1b9954a0aa410f5e480f3a000b9}{RemoteControlInit}}(\mbox{\hyperlink{group___u_a_r_t___exported___types_ga5de4a49eb132735325e706f406c69d6e}{UART\_HandleTypeDef}}\ *rc\_usart\_handle);}
\DoxyCodeLine{00125\ }
\DoxyCodeLine{00131\ uint8\_t\ \mbox{\hyperlink{remote__control_8h_acfec81351f882dc5d2a47ad94684d834}{RemoteControlIsOnline}}();}
\DoxyCodeLine{00132\ }
\DoxyCodeLine{00133\ \textcolor{preprocessor}{\#endif}}

\end{DoxyCode}
